<!DOCTYPE html>
<html>

<head>

    {include file="Public/header"}
     <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <style>
        .row {
            margin: 0;
            padding: 0
        }
        .inputremindPeple {
            max-width: 200px;
            height: 20px;
            display: inline-block;
        }

        .aprovalSystemTable thead th {
            text-align: center;
        }
    </style>

</head>

<body class="white-bg">
<div class="white-bg setRemindPeopleK">
  <div class="page-heade">
       <h2 class="title_color text-center">批量维系系统供应商</h2>
    </div>
    <form action="" class="form-group" id="form1">
        <table class="table table-bordered bud_hei">

            <tr>
                <td class="text-right"><label for="sn">经销商编号：</label></td>
                <td><input type="text" class="form-control inputremindPeple" id="sn" name="sn" value="{$sn}"></td>
                <td class="text-right"><label for="AgencyName">经销商名称：</label></td>
                <td><input type="text" class="form-control inputremindPeple" id="AgencyName" name="title" value="{$title}"></td>
                <td class="text-right"><label for="systemNo">系统编号：</label></td>
                <td><input type="text" class="form-control inputremindPeple" name="systemNo" id="systemNo" value="{$systemNo}"></td>
            </tr>
            <tr>
                <td class="text-right"><label for="systemName">系统名称：</label></td>
                <td colspan="5"><input type="text" class="form-control inputremindPeple" name="systemName" id="systemName" value="{$systemName}"></td>
            </tr>
            <tr>
                <td colspan="6" style="text-align: center;">
                    <button class="btn btn-info">查询</button>
                    <button class="btn btn-info emtyif" id="reset">清空查询条件</button>
                </td>
            </tr>
        </table>
    </form>
    <p>操作说明：</p>
    <p>1.更换经销商：把本经销商负责的所有系统切换到另一个经销商，本经销商的系统清空。</p>
    <p>2.追加到其他经销商：把本经销商负责的所有系统全部追加到另外一个经销商，本经销商的系统继续保留(追加后会相关系统同时由这两个经销商同时供货)。</p>
    <p>3.停止供货：把本经销商负责的所有系统全部清空（如负责的系统有任意一个未有另外一家供货的经销商，则无法停止）。</p>
    <table class="table table-bordered bud_hei table-striped text-center table-hover " style="width: 100%;">
        <tr class="info">
            <th class="text-center">No.</th>
            <th class="text-center">经销商编号</th>
            <th class="text-center">经销商名称</th>
            <th class="text-center">供货系统</th>
            <th class="text-center">操作</th>
        </tr>
        <tbody style="border: 0">
            {volist name="data" id="row" key="k"}
            <tr>
                <td>{$k}</td>
                <td>{$row.sn}</td>
                <td>{$row.title}</td>
                <td>{$row.systems}</td>
                <td>
                    <a href="{:url('tihuan',array('id'=>$row.id))}" class="tihuan">更换经销商</a>
                    <a href="{:url('update',array('id'=>$row.id))}" class="xiugai">修改</a>
                    <a href="{:url('delete',array('id'=>$row.id))}" class="stopAfford">停止供货</a>
                    <a href="{:url('zhuijia',array('id'=>$row.id))}" class="zhuijia">追加到其他经销商</a>
                </td>
            </tr>
            {/volist}
        </tbody>
    </table>
     <div class="row text-center" id="pageText" style="padding: 0;margin: 0;">
			<div class="col-sm-6 text-left"><div class="padding-10 countSize">共{$count}条记录，{$maxpage}页&nbsp;&nbsp;</div></div>
			<div class="col-sm-6 text-right">{$page}</div>
	</div>
</div>

<!-- 全局js -->
{include file="Public/footer"}
<script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
<script>
    $(document).ready(function () {
        //清除查询条件
        $('#reset').on('click',function () {
            $("#form1 input").each(function(){
                $(this).val('');
            });
            $("#form1 select").each(function(){
                $(this).val('');
            });
            $('#form1').submit()
            return false
        })

        //修改
        $(".xiugai").click(function () {
            var link = $(this).attr('href')
            index = layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: link
            })
            layer.full(index)
            return false
        });
        //替换
        $(".tihuan").click(function () {
            var link = $(this).attr('href')
            index = layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: link
            })
            return false
        });
        //追加
        $(".zhuijia").click(function () {
            var link = $(this).attr('href')
            index = layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: link
            })
            return false
        });
        //停止供货
        $('.stopAfford').click(function () {
            var link = $(this).attr('href')
            swal({
                title: "您确定吗",
                text: "",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "确定停止",
                closeOnConfirm: false
            }, function (isConfirm) {
                if(isConfirm){
                    $.ajax({
                        'type':'post',
                        'url':link,
                        'dataType':'json',
                        'success':function (data) {
                            if(data.success){
                                location.reload()
                            }else
                                swal(data.msg, "", "error");
                        }
                    })
                }

            });
            return false
        });
    })
</script>
</body>

</html>